<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>model</title>
    <script src="https://unpkg.com/vue"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">

</head>
<body>
<div id="app">
    <input type="button" value="获取元素" @click="getElement">

    <h3 id="myh3" ref="m">哈哈哈哈</h3>
    <hr>
    <login ref="myLogin"></login>
</div>

</body>
<script>
    var login = {
        template: '<h1>登录组件</h1>',
        data(){
            return{
                msg: 'son msg'
            }
        },
        methods:{
            show(){
                console.log('son');
            }
        }
    };


var vm = new Vue({
    el: '#app',
    data: {
        msg: '大家好哈哈哈哈，你们好啊。'
    },
    methods:{
        getElement(){
            // ref (英文单词【reference】： 引用)
            // console.log(this.$refs.m.innerText);
            console.log(this.$refs.myLogin.msg);
        }
    },
    components:{
        login: login,
    }

})
</script>
</html>